package com.cyl.manager.oms.mapper;

import java.time.LocalDateTime;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cyl.h5.domain.vo.CountOrderVO;
import com.cyl.h5.domain.vo.H5OrderVO;
import com.cyl.manager.aws.domain.entity.SystemStatistics;
import com.cyl.manager.oms.domain.entity.Order;
import com.cyl.manager.oms.domain.form.ManagerOrderQueryForm;
import com.cyl.manager.oms.domain.form.OrderQueryQy;
import com.cyl.manager.oms.domain.query.DpOrderQuery;
import com.cyl.manager.oms.domain.vo.DpOrderProductVO;
import com.cyl.manager.oms.domain.vo.DpOrderVO;
import com.cyl.manager.oms.domain.vo.ManagerOrderShopVO;
import com.cyl.manager.oms.domain.vo.ManagerOrderVO;
import com.cyl.manager.oms.domain.vo.OrderAmoutVO;
import com.cyl.manager.oms.domain.vo.OrderGysVo;
import com.cyl.manager.statistics.domain.vo.OrderAndAftersaleStatisticsVO;
import com.cyl.manager.ums.domain.vo.MemberDataStatisticsVO;
import org.apache.ibatis.annotations.Param;

/**
 * 订单表Mapper接口
 * 
 * @author zcc
 */
public interface OrderMapper extends BaseMapper<Order> {
    /**
     * 查询订单表列表
     *
     * @param order 订单表
     * @return 订单表集合
     */
    List<Order> selectByEntity(Order order);

    List<ManagerOrderVO> selectManagerOrderPage(ManagerOrderQueryForm request);

    ManagerOrderVO selectManagerOrderPageSun(ManagerOrderQueryForm request);
    
    int lockManagerOrder(ManagerOrderQueryForm request);

    int batchDeliverProductZt(ManagerOrderQueryForm request);

    //统计支付未退款的店铺订单
    List<ManagerOrderVO> selectShopHxProductTj(ManagerOrderQueryForm request);


    
    
    
    List<H5OrderVO> orderPage(
    		@Param("lockIdNotIsNull") String lockIdNotIsNull,
    		@Param("lockIdIsNull") String lockIdIsNull,
    		@Param("sendGysStatus") Integer sendGysStatus, @Param("status") Integer status,   @Param("memberId")Long memberId, @Param("keyword") String keyword);

    H5OrderVO selectOrderDetail(Long orderId);

    CountOrderVO countByStatusAndMemberId(Long memberId);

//    Integer cancelBatch(@Param("list") List<Order> orderList);

    MemberDataStatisticsVO statOrderCountAndAmount(Long memberId);


    Integer statWaitDelivered();

    OrderAndAftersaleStatisticsVO statTodayData(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);

    SystemStatistics statNewAndDeal(@Param("startTime") LocalDateTime startTime,@Param("endTime") LocalDateTime endTime
    		,@Param("deptZbjId") Long deptZbjId ,@Param("deptTzId")Long deptTzId ,@Param("deptDpId")Long deptDpId);
    
    
    int statDealMember(@Param("startTime") LocalDateTime startTime,@Param("endTime") LocalDateTime endTime
    		,@Param("deptZbjId") Long deptZbjId ,@Param("deptTzId")Long deptTzId ,@Param("deptDpId")Long deptDpId);
    
    
    int orderLock(@Param("startTime") LocalDateTime startTime,@Param("endTime") LocalDateTime endTime,@Param("deptZbjId") Long deptZbjId,@Param("lockId") Long lockId);
    
    int orderGysStatus(OrderGysVo order);
    
    int jobCancelOrder(@Param("outTime") LocalDateTime outTime);

    
    OrderAmoutVO getOrderAmount(@Param("lockId") Long lockId,@Param("prepareId") Long prepareId);

    
//    SELECT
//	* 
//FROM
//	oms_order 
//WHERE
//	payment_time IS NOT NULL 
//	AND aftersale_time IS NULL 
//	AND receive_time IS NULL
//	AND member_id  = 10015
    
    //查询这个人有多少订单没有核销
	int selectOrderCountByMemberId(@Param("memberId") Long memberId);

	
	
    /*****大屏统计*****/
    List<DpOrderProductVO> selectDpCjph(DpOrderQuery dpOrderQuery);
    List<DpOrderVO> selectDpCjzs(DpOrderQuery dpOrderQuery);
    List<DpOrderVO> selectDp5min(DpOrderQuery dpOrderQuery);
	int selectProductWzfTj(DpOrderQuery dpOrderQuery);
	
	
    List<DpOrderVO> selectDpGmvCjzs(DpOrderQuery dpOrderQuery);
    
    List<DpOrderVO> selectDpTjByProductId(DpOrderQuery dpOrderQuery);

	Integer selectProductXl(@Param("productId") Long productId);
    
	DpOrderVO selectProductXlTj(@Param("productId") Long productId);

	List<ManagerOrderShopVO> selectListByShop(ManagerOrderQueryForm query);


    /*****大屏统计*****/

   
	int orderZd(OrderQueryQy orderQueryQy);


}
